<?php 

//The core class of PHPFun framework
class PHPFun{

	public static $controller;
	public static $action;
	public static $config;
	
	public static function run(){

		$C = isset($_GET['c'])?ucfirst($_GET['c']):'Index';
		$A = isset($_GET['a'])?ucfirst($_GET['a']):'index';
		
		//save the data 
		self::$controller = $C;self::$action = $A;

		$c_file = APP_PATH.'/Controller/'.$C.'Controller.class.php';
		if(file_exists($c_file)){
			require($c_file);
		}else{
			exit('controller not exists.');
		}

		$c_class = $C.'Controller';
		if(class_exists($c_class)){
			$controller = new $c_class();
		}else{
			exit('controller not exists.');
		}

		if(method_exists($controller,$A)){
			$controller->$A();
		}else{
			exit('method not exists.');
		}
	}
}


?>